package com.rd.student.ruanjian.class4.zhouzihe.day0802;

import java.util.Scanner;

//奇数序列 前n项和
public class Practice2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入一个数");
        int n = scanner.nextInt();
        double sum = 0;
        int d = 1;
        for (int i = 1; i <= n; i++) {
            sum += 1.0 / d;
            d = d + 2;

        }
        System.out.println(String.format("%.2f", sum));
    }
}
